﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8" />
    <title>驰骋工作流</title>
    <script language="JavaScript" src="../../Comm/JScript.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../Scripts/bootstrap/js/jquery.min.js"></script>
    <script src="../../Scripts/QueryString.js" type="text/javascript"></script>
    <link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <link href="../../Scripts/easyUI145/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <!-- 引用通用的js文件. -->
    <script type="text/javascript" src="../../Scripts/config.js"></script>
    <script type="text/javascript" src="../../Comm/Gener.js"></script>
    <script src="../Admin.js"></script>
    <style>
        #Btn_Save {
            background-image: url(../../Img/Btn/Save.png) !important;
        }
    </style>
    <script type="text/javascript" language="javascript">
        //页面启动函数.
        $(function () {

            $("#Msg").html("正在加载,请稍后......");

            InitPage();

            $("#Msg").html("");
        });
        //初始化数据.
        function InitPage() {

            var fk_node = GetQueryString("FK_Node");

            var node = new Entity("BP.WF.Node", fk_node);

            //调用公共类库的方法:执行批量主表赋值.
            // GenerBindEnumKey("DDL_BRole", "BatchRole", node.BatchRole);

            //获得属性集合.
            var attrs = new Entities("BP.Sys.MapAttrs");
            attrs.Retrieve("FK_MapData", "ND" + fk_node);

            //增加处理.
            for (var i = 0; i < attrs.length; i++) {
                var item = attrs[i];
                if (item.UIVisible == false)
                    continue;
                var newRow = "";
                newRow = "<tr ><td class=Idx>" + i + "</td>";
                if (node.BatchParas.indexOf(item.KeyOfEn) > -1) {
                    newRow += "<td>" + "<input name='CB_Node' type='checkbox' value='" + item.KeyOfEn + "' checked='checked' />" + item.KeyOfEn + "</td>";
                } else {
                    newRow += "<td>" + "<input name='CB_Node' type='checkbox' value='" + item.KeyOfEn + "' />" + item.KeyOfEn + "</td>";
                }
                newRow += "<td>" + item.Name + "</td>";
                newRow += "<td>" + item.LGTypeText + "</td>";
                newRow += "</tr>";
                $("#table1 tr:last").after(newRow);
            }
            $("#DDL_BRole").val(node.BatchRole);

            return;
        }



        function Btn_Save_Click() {
            var checkBoxIDs = "";
            var cb = $("input[name='CB_Node']:checked").each(function (j) {
                checkBoxIDs += $(this).val() + ","; //获得所有的 checkBox ID传入到后台去,用于解决checkbox控件，在没有被选择的时候，没有值的问题。
            });;

            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_AttrNode");
            handler.AddPara("FK_Node", GetQueryString("FK_Node"));
            handler.AddPara("CheckBoxIDs", checkBoxIDs);
            handler.AddPara("FK_Flow", GetQueryString("FK_Flow"));
            handler.AddFormData();
            var data = handler.DoMethodReturnString("BatchStartFields_Save");

            if (data.indexOf('err@') >= 0) {
                alert(data);
                return;
            }
            alert(data);
            window.location.href = window.location.href;
            return;

        }
    </script>
</head>
<body  >

<form id="cc">
    <div style="right:30px; position:absolute; z-index:100; top:-4px">
        <input type="button" ID="Btn_Save" runat="server" value="保存" onclick="Btn_Save_Click()" />
    </div>
    <div style="position:relative;">
        <table style="width: 100%;">
            <caption><img style="margin-bottom:8px;" align="middle" src='../../Img/Event.png' />批处理规则设置</caption>
            <tr>
                <td colspan="1">规则设置：</td>
                <td colspan="2">
                    <select ID="DDL_BRole" name="DDL_BRole" style="width:130px">
                        <option value="0"> 不可以 </option>
                        <option value="1"> 批量审批 </option>
                        <option value="2"> 分组批量审核 </option>

                    </select>
                </td>
                <td><a href="http://ccbpm.mydoc.io/?v=5404&t=17920" target="_blank">帮助</a> </td>
            </tr>
            <tr>
                <td colspan="1">显示的行数：</td>

                <td colspan="2">
                    <input type="text" value="12" ID="TB_BatchListCount" name="TB_BatchListCount" runat="server" style="width:56px" />
                </td>

                <td> 0表示显示所有</td>
            </tr>
            <tr>
                <td class="Sum" colspan="4">
                    批量发起字段(需要显示的字段.)
                </td>
            </tr>


            <tr>
                <td colspan="4">

                    <table style=" width:100%;" id="table1">
                        <tr>
                            <th>序</th>
                            <th>字段</th>
                            <th>名称 </th>
                            <th>类型</th>
                        </tr>


                    </table>

                </td>
            </tr>
        </table>
    </div>
</form>

</body>
</html>
